import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/Layout'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home', //重定向
    component: Layout,
    children:[
      {
        path: '/home',
        component: ()=> import('@/views/home') 
      },
      {
        path: '/categress',
        component: ()=> import('@/views/Categress') 
      },
      {
        path: '/cart',
        component: ()=> import('@/views/Cart') 
      },
      {
        path: '/my',
        component: ()=> import('@/views/My') 
      },
    ]
  },
  
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
